package com.easytext.factory;

import com.easytext.api.Analyzer;
import com.easytext.coleman.Coleman;
import com.easytext.kincaid.FleschKincaid;

import java.util.List;

/**
 * @author caifan
 * @created 2021/11/28
 * @description:
 */
public class AnalyzerFactory {
    public static List<String> getSupportedAnalyses() {
        return List.of(FleschKincaid.NAME, Coleman.NAME);
    }

    public static Analyzer getAnalyzer(String name) {
        switch (name) {
            case FleschKincaid.NAME: return new FleschKincaid();
            case Coleman.NAME: return new Coleman();
            default: throw new IllegalArgumentException("No such analyzer!");
        }
    }
}
